package com.bstek.demo.esasyules;

import org.jeasy.rules.annotation.Action;
import org.jeasy.rules.annotation.Condition;
import org.jeasy.rules.annotation.Fact;
import org.jeasy.rules.annotation.Rule;
import org.jeasy.rules.api.Facts;

/**
 * 判断一个数是否为偶数
 */
@Rule(name = "EvenNumberRule rule", description = "偶数判断")
public class EvenNumberRule {
    @Condition
    public boolean when(@Fact("num") int num) {
        return num%2==0;
    }

    @Action(order = 1)
    public void then(Facts facts) {
        facts.put("result","我是偶数");
    }
}